package org.luckyjourney.entity.agent;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 3智能体对话表
 * @TableName agent_chat
 */
@Data
public class AgentChat implements Serializable {
    /**
     * 对话ID
     */
    @TableId(value = "chat_id", type = IdType.AUTO)
    private Integer chatId;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 智能体ID
     */
    @TableField(value = "agent_chat_id")
    private int agentChatId;

    /**
     * 用户输出
     */
    private String userMsg;

    /**
     * 智能体输出
     */
    private String agentMsg;

    /**
     * 上下文ID （为空则为当前在进行的对话，随机不重复值为历史对话）
     */
    private String contentId;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    private static final long serialVersionUID = 1L;

    @TableField(value = "audio_link")
    private String audioLink;

    /**
     * 对话ID
     */
    public Integer getChatId() {
        return chatId;
    }

    /**
     * 对话ID
     */
    public void setChatId(Integer chatId) {
        this.chatId = chatId;
    }

    /**
     * 用户ID
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 用户ID
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    /**
     * 智能体ID
     */
    public int getAgentChatId() {
        return agentChatId;
    }

    /**
     * 智能体ID
     */
    public void setAgentChatId(Integer agentId) {
        this.agentChatId = agentId;
    }

    /**
     * 用户输出
     */
    public String getUserMsg() {
        return userMsg;
    }

    /**
     * 用户输出
     */
    public void setUserMsg(String userMsg) {
        this.userMsg = userMsg;
    }

    /**
     * 智能体输出
     */
    public String getAgentMsg() {
        return agentMsg;
    }

    /**
     * 智能体输出
     */
    public void setAgentMsg(String agentMsg) {
        this.agentMsg = agentMsg;
    }

    /**
     * 上下文ID （为空则为当前在进行的对话，随机不重复值为历史对话）
     */
    public String getContentId() {
        return contentId;
    }

    /**
     * 上下文ID （为空则为当前在进行的对话，随机不重复值为历史对话）
     */
    public void setContentId(String contentId) {
        this.contentId = contentId;
    }

    /**
     * 创建时间
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AgentChat other = (AgentChat) that;
        return (this.getChatId() == null ? other.getChatId() == null : this.getChatId().equals(other.getChatId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
//            && (this.getAgentChatId() == null ? other.getAgentChatId() == null : this.getAgentChatId().equals(other.getAgentChatId()))
            && (this.getUserMsg() == null ? other.getUserMsg() == null : this.getUserMsg().equals(other.getUserMsg()))
            && (this.getAgentMsg() == null ? other.getAgentMsg() == null : this.getAgentMsg().equals(other.getAgentMsg()))
            && (this.getContentId() == null ? other.getContentId() == null : this.getContentId().equals(other.getContentId()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getChatId() == null) ? 0 : getChatId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
//        result = prime * result + ((getAgentChatId() == null) ? 0 : getAgentChatId().hashCode());
        result = prime * result + ((getUserMsg() == null) ? 0 : getUserMsg().hashCode());
        result = prime * result + ((getAgentMsg() == null) ? 0 : getAgentMsg().hashCode());
        result = prime * result + ((getContentId() == null) ? 0 : getContentId().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", chatId=").append(chatId);
        sb.append(", userId=").append(userId);
        sb.append(", agentChatId=").append(agentChatId);
        sb.append(", userMsg=").append(userMsg);
        sb.append(", agentMsg=").append(agentMsg);
        sb.append(", contentId=").append(contentId);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}